Configure SSH Server - Password Authentication
2014/08/02 |
Configure SSH Server to manage a server from the remore computer. SSH uses 22/TCP.
|
|
[1] | SSHd is installed even if you installed CentOS with "Minimal Install", so it's not necessarry to install new packages. Furthermore, SSHd is set auto-start setting by default, so it's possible to login without chainging ant settings. But it had better to change for security settings like follows. |
[root@dlp ~]#
vi /etc/ssh/sshd_config # line 42: uncomment and change ( prohibit root login remotely ) PermitRootLogin no
# line 65: uncomment PermitEmptyPasswords no PasswordAuthentication yes /etc/rc.d/init.d/sshd restart |
[2] | If IPtables is running, allow SSH port. SSH uses 22/TCP. For "-I INPUT 5" section below, Replace it to your own environment. |
[root@dlp ~]# iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
Configure SSH Client : CentOS
|
Configure SSH Client of CentOS.
|
|
[2] | Install SSH Client. |
[root@client ~]# yum -y install openssh-clients
|
[3] | Connect to the SSH server with a common user. |
# ssh [username@hostname or IP address] [root@client ~]# ssh cent@dlp.srv.world The authenticity of host 'dlp.srv.world (<no hostip for proxy command>)' can't be established. ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:60:90:d8. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'dlp.srv.world' (ECDSA) to the list of known hosts. cent@dlp.srv.world's password: # password of the user [cent@dlp ~]$ # just logined |
[4] | It's possbile to execute commands on remote Host with adding commands to ssh command. |
# for example, open /etc/passwd on remote host [cent@client ~]$ ssh cent@dlp.srv.world "cat /etc/passwd" cent@dlp.srv.world's password: root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin ... ... postfix:x:89:89::/var/spool/postfix:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin |
Configure SSH Client : Windows
|
Configure SSH Client of Windows.
|
|
[5] |
Get a SSH Client for Windows. This example shows to use Putty like follows.
Input your server's IP address and Click 'Open' button.
|
[6] | After authentication on SSH server, it's possible to login remotely with SSH. |